package org.example.seckill.controller;

import org.example.core.utils.R;
import org.example.seckill.entity.RegularSeckill;
import org.example.seckill.service.SeckillScheduledService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/seckill/backend")
public class SeckillBackendController {

    @Autowired
    private SeckillScheduledService seckillScheduledService;

    @GetMapping("/sku/{id}")
    public R<?> getSeckillSku(@PathVariable("id") Long skuId){
        RegularSeckill regularSeckill = seckillScheduledService.getSeckillSku(skuId);
        return R.ok(regularSeckill);
    }
}
